package org.jivesoftware.smack.packet;

import org.jivesoftware.smack.util.StringUtils;

public class Authentication extends IQ
{
  private String username = null;
  private String password = null;
  private String digest = null;
  private String resource = null;

  public Authentication()
  {
    setType(IQ.Type.SET);
  }

  public String getUsername()
  {
    return this.username;
  }

  public void setUsername(String paramString)
  {
    this.username = paramString;
  }

  public String getPassword()
  {
    return this.password;
  }

  public void setPassword(String paramString)
  {
    this.password = paramString;
  }

  public String getDigest()
  {
    return this.digest;
  }

  public void setDigest(String paramString1, String paramString2)
  {
    this.digest = StringUtils.hash(paramString1 + paramString2);
  }

  public void setDigest(String paramString)
  {
    this.digest = paramString;
  }

  public String getResource()
  {
    return this.resource;
  }

  public void setResource(String paramString)
  {
    this.resource = paramString;
  }

  public String getChildElementXML()
  {
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append("<query xmlns=\"jabber:iq:auth\">");
    if (this.username != null)
      if (this.username.equals(""))
        localStringBuilder.append("<username/>");
      else
        localStringBuilder.append("<username>").append(this.username).append("</username>");
    if (this.digest != null)
      if (this.digest.equals(""))
        localStringBuilder.append("<digest/>");
      else
        localStringBuilder.append("<digest>").append(this.digest).append("</digest>");
    if ((this.password != null) && (this.digest == null))
      if (this.password.equals(""))
        localStringBuilder.append("<password/>");
      else
        localStringBuilder.append("<password>").append(StringUtils.escapeForXML(this.password)).append("</password>");
    if (this.resource != null)
      if (this.resource.equals(""))
        localStringBuilder.append("<resource/>");
      else
        localStringBuilder.append("<resource>").append(this.resource).append("</resource>");
    localStringBuilder.append("</query>");
    return localStringBuilder.toString();
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     org.jivesoftware.smack.packet.Authentication
 * JD-Core Version:    0.6.1
 */